/**
 * 
 */
package com.dream.house.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import cn.com.servyou.base.exception.ServiceException;
import cn.com.servyou.utils.Page;

import com.dream.house.dao.AllowanceDAO;
import com.dream.house.entity.AllowanceDTO;

/**
 * @author ahk
 * @since 1.0
 */
public class AllowanceService extends HouseBaseService{
	
	@Autowired
	private AllowanceDAO allowanceDAO;
	
	
	public boolean saveAllowance(AllowanceDTO dto) throws ServiceException {
		if(dto!=null){
			dto.setAllowance_id(allowanceDAO.getMaxId());
			return allowanceDAO.saveAllowance(dto);
		}
		
		return false;
	}

	public boolean modifyAllowance(AllowanceDTO dto) throws ServiceException {
		if(dto!=null)
			return allowanceDAO.updateAllowance(dto);
		
		return false;
	}

	public boolean removeAllowance(String id) throws ServiceException {
		
		return allowanceDAO.removeAllowance(id);
	}

	public List<AllowanceDTO> findAllowances(AllowanceDTO dto)
			throws ServiceException {
		
		return allowanceDAO.findAllowances(dto);
	}

	public Page findByPage(Map<String, Object> condition, int pageNo,
			int pageSize) throws ServiceException{
		
		return allowanceDAO.findByPage(condition, pageNo, pageSize);
	}
	
	public AllowanceDTO getAllowance(String id) throws ServiceException {
		return allowanceDAO.getAllowance(id);
	}

	boolean grant(String id, String status, String checkUser)
			throws ServiceException {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	boolean check(Map<String, String> condition) throws ServiceException {
		// TODO Auto-generated method stub
		return false;
	}

}
